/*
 * @(#)ProductService.java 2021/3/9
 *
 * Copyright (c) 2010 by rayootech.com. All rights reserved.
 */
package com.nuctech.order.service;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.nuctech.common.constant.CommonConstants;
import com.nuctech.common.entity.Product;

/**
 * Feign商品微服务调用接口
 *
 * @author lilu
 * @date 2021/3/9 11:44 上午
 * @since 1.0.0
 */
@FeignClient(
	value = CommonConstants.MicroService.Product
//	fallbackFactory = ProductServiceFallBackFactory.class
) // 指定调用Nacos下哪个微服务
@RequestMapping("/product")
public interface ProductService {

	/**
	 * 获取商品信息
	 *
	 * @author lilu
	 * @date 2021/3/9 11:54 上午
	 * @since 1.0.0
	 *
	 * @param pid
	 * @return com.nuctech.common.entity.Product
	 * @throws
	 */
	@GetMapping("/{pid}")
	Product product(@PathVariable("pid") Integer pid);
	/**
	 * 扣减库存
	 * <p>Feign远程调用时参数需要加{@code @RequestParam}
	 *
	 * @author lilu
	 * @date 2021/3/28 12:58 下午
	 * @since 1.0.0
	 *
	 * @param pid 商品编号
	 * @param number 扣减数量
	 * @return java.lang.Integer 剩余库存
	 * @throws
	 */
	@PostMapping("/reduceInventery")
	Integer reduceInventery(@RequestParam("pid") Integer pid, @RequestParam("number") Integer number);

}
